package com.lagou.edu.server;

import java.util.concurrent.*;

/**
 * @author 胡益文
 * @since 2021/10/13 15:40
 */
public class Server extends LifecycleBase {
    private ThreadPoolExecutor threadPoolExecutor;
    private Service services[] = new Service[0];

    public Server(Service[] services) {
        this.services = services;
    }

    @Override
    protected void initInternal() throws Exception {
        for (Service service : services) {
            //使用模板方法调用
            service.init();
        }
    }

    @Override
    protected void startInternal() throws Exception {
        for (Service service : services) {
            //使用模板方法调用
            service.start();
        }
    }
}
